package com.hualude.roadsign.controller;

import com.hualude.roadsign.dto.DTRequestDto;
import com.hualude.roadsign.dto.DTResponseDto;
import com.hualude.roadsign.dto.JsonMsgDto;
import com.hualude.roadsign.service.SolarEnergyCheckService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by ding on 2017/7/10.
 */
@Controller
@RequestMapping("/rds_solarEnergyCheck")
public class SolarEnergyCheckController {

    @Resource
    private SolarEnergyCheckService solarEnergyCheckService;

    @RequestMapping(value = "/getSolarFault4DT")
    @ResponseBody
    public DTResponseDto getSolarFault4DT(DTRequestDto dtRequestDto,Integer actorId ,Integer orgId) {
        DTResponseDto dtResponseDto = new DTResponseDto();
        try {
            dtResponseDto = solarEnergyCheckService.getSolarFault4DT(dtRequestDto,actorId, orgId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dtResponseDto;
    }

    @RequestMapping(value = "/solarFaultAudit")
    @ResponseBody
    public JsonMsgDto solarFaultAudit(Integer isPass, String solarFeedback, Integer solarFaultId, Integer userId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(solarEnergyCheckService.solarFaultAudit(isPass, solarFeedback, solarFaultId, userId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getSolarFaultCheckList4App")
    @ResponseBody
    public JsonMsgDto getSolarFaultCheckList4App(Integer orgId, String actorIds, Integer faultStatus, Integer count, Integer size)
            throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(solarEnergyCheckService.getSolarFaultCheckList4App(orgId, actorIds, faultStatus, count, size));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/solarFaultCheck")
    @ResponseBody
    public JsonMsgDto solarFaultCheck(Integer isPass, String solarFeedback, Integer solarFaultId, Integer userId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(solarEnergyCheckService.solarFaultCheck(isPass, solarFeedback, solarFaultId, userId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }
}
